home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / prodpack.zip / DB4PPSRC.EXE / _FILEPAT.PRG < prev    next >
Text File  |  1993-05-04  |  1KB  |  50 lines

  1. FUNCTION _FilePath
  2. PARAMETER pc_fname
  3. *--------------------------------------------------------------------
  4. * NAME
  5. *   _FILEPATH - Returns path portion of a complete filespec.
  6. *
  7. * SYNOPSIS
  8. *   _FILEPATH( pc_fname )
  9. *
  10. * DESCRIPTION
  11. *   _FILEPATH() returns the path from the full
  12. *   description of the file specified by pc_fname.
  13. *   The drive letter, if any, is not returned.
  14. *
  15. *   If the filespec does not contain a path, the
  16. *   null string ("") is returned.
  17. *
  18. * PARAMETER
  19. *   pc_fname - A character full DOS filespec.
  20. *
  21. * EXAMPLE
  22. *   lc_fpath = _FilePath( "C:\TEST\FOO.PRG" )
  23. *     ( lc_fpath will equal "\TEST\" )
  24. *
  25. *   lc_fpath = _FilePath( "MYFILE.TXT" )
  26. *     ( lc_fpath will equal "" )
  27. *
  28. * SEE ALSO
  29. *   _FILEDRV(), _FILEROOT(), _FILETYPE()
  30. *
  31. *--------------------------------------------------------------------
  32.   PRIVATE ln_pathpos, lc_slash
  33.  
  34.   IF LEFT( OS(), 3 ) = "DOS"
  35.     lc_slash = "\"
  36.   ELSE
  37.     lc_slash = "/"
  38.   ENDIF
  39.  
  40.   ln_pathpos = AT( lc_slash, pc_fname )
  41.  
  42. RETURN( IIF( ln_pathpos > 0, ;
  43.              SUBSTR( pc_fname, ln_pathpos, ;
  44.                      RAT(lc_slash,pc_fname)-ln_pathpos+1 ),;
  45.              "" ) )
  46. *-- EOF: _FilePath( pc_fname )
  47.  
  48.  
  49.  
  50.